<template>
  <div class="page-wrapper">
    <el-pagination
      class="is-background"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @current-change="changeCurrentPage"
      @size-change="changePagesize"
    />
  </div>

</template>

<script type="text/ecmascript-6">
export default {
  name: 'PageContainer',
  props: {
    listObj: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  computed: {
    total() {
      return this.listObj && this.listObj.data ? this.listObj.total : 0
    },
    currentPage() {
      return this.listObj && this.listObj.data ? this.listObj.current_page : 1
    },
    pageSize() {
      return this.listObj && this.listObj.data ? this.listObj.per_page : 1
    }
  },
  methods: {
    changeCurrentPage(val) {
      this.$emit('changeCurrentPage', val)
    },
    changePagesize(val) {
      this.$emit('changePagesize', val)
    }
  }
}
</script>

<style lang="scss" scoped>
.page-wrapper{
  margin-top:15px;
}
</style>
